//加了缓冲区的文件,加快文件读取速度
#ifndef RTSP_SERVICE_RLBUFFILE_H
#define RTSP_SERVICE_RLBUFFILE_H

#include <stdio.h>

#define RLBUFFILE_RET_ERROR     -1
#define RLBUFFILE_RET_SUCCEED   0
#define RLBUFFILE_RET_EOF       1

//用于从文件中读取数据，加快读取速度.
typedef struct RLBufFile {
    FILE *file;              //h264文件
    unsigned int data_len;   //缓冲区数据长度
    unsigned int index;      //缓冲区读取引索
    unsigned int buf_len;        //缓冲区长度
    unsigned char *buf;      //缓冲区
} RLBufFile;

extern void RLBufFile_init(RLBufFile *buffile, FILE *onlyreadfile, unsigned char *buf, unsigned int buf_len);

extern int RLBufFile_read_byte(RLBufFile *buffile, unsigned char *ch);

extern int RLBufFile_read_back(RLBufFile *buffile);

#endif //RTSP_SERVICE_RLBUFFILE_H
